//当前这个模块：api进行统一管理
import requests from './request';

//三级联动接口 /api/product/getBaseCategoryList 


import mockRequests from './mockAjax';

export const reqCategoryList  =()=>{
    //发请求:axios发送请求返回结果Promise对象
   return  requests({url:'/product/getBaseCategoryList',methods: 'get'
   });
}

//获取banner（home首页轮播图接口）
export const reqGetBannerList  =()=>{
    //发请求:axios发送请求返回结果Promise对象
   return  mockRequests({url:'/banner',methods: 'get'
   });
}

export const reqFloorList =()=>{
    return mockRequests({url:'/floor',method:'get'})
}

//获取搜索模块的数据 地址：/api/list 请求方式：post  

export const reqGetSearchInfo = (params)=>requests({
    url:"/list",
    method:"post",
    data:params

})

//获取商品详情接口
export const reqGoodInfo =(skuid)=>requests({
    url:`/item/${skuid}`,
    method:"get"
});


//将产品添加到购物车中 （获取更新某一个产品的个数）
export const reqAddOrUpdateShopCart= (skuId,skuNum)=> requests({
  url:`/cart/addToCart/${skuId}/${skuNum}`,
  method:"post"  
})

//获取购物车列表数据接口
export const reqCartList =()=>requests({
    url:"/cart/cartList",
    method:'get'
})

// 删除购物车产品接口
export const reqDeleteCartById=(skuId)=>requests({
    url:`/cart/deleteCart/${skuId}`,
    method:'delete'

})

//获取验证码
export const reqGetCode = (phone)=>requests({
    url:`/user/passport/sendCode/${phone}`,
    method:'get'
})

//注册接口
export const reqUserRegister = (data)=>requests({
    url:'/user/passport/register',
    data,
    method:'post'
})

//登录接口
export const reqUserLogin = (data)=>requests({
    url:'/user/passport/login',
    data,
    method: 'post'
})

//获取用户信息【需要带用户token向服务器要用户信息】
export const reqUserInfo=()=>requests({
    url:"/user/passport/auth/getUserInfo",
    method:'get'

})